﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.IO.IsolatedStorage;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace OneStop.UI
{
    public partial class OpenProfileUserControl : UserControl
    {
        public event EventHandler<LoadProfileEventArgs> LoadProfile;

        public OpenProfileUserControl()
        {
            InitializeComponent();
        }

        protected void OnLoadProfile(string filename)
        {
            if (this.LoadProfile != null)
            {
                LoadProfile(this, new LoadProfileEventArgs() { FileName = filename });
            }
        }

        private void OpenLocal_Click(object sender, RoutedEventArgs e)
        {
            if (SavedProfiles.SelectedIndex > -1)
            {
                OnLoadProfile(SavedProfiles.SelectedItem.ToString());
            }
        }
    }

    public class LoadProfileEventArgs : EventArgs
    {
        public string FileName { get; set; }
    }
}
